//
// Created by mac on 1/25/22.
//

#include <iostream>
#include <vector>

using namespace std;

bool repeatedSubstringPattern(string s) {
    int n = s.size();
    for (int len = 1; len *2<= n; ++len) {
        if(n%len==0){
            bool match = true;
            int i = 0;
            for (int j = len; j < n ; j++, i++) {
                if(s[i]!=s[j]){
                    match = false;
                    break;
                }
            }
            if(match){ return true;}
        }
    }
    return false;
}


bool repeatedSubstringPattern1(string s) {


    return (s+s).find(s, 1)!=s.size();

}


